package com.kaifamiao.interfaces;

public class TestUSB {

    public static void main(String[] args) {

        // 接口类型的引用变量指向实现类类型的实例(或对象)
        Rechargeable r = new UGreen();
        r.charge();

        Transportable t = new UGreen();
        t.transmit();

        System.err.println( "- ".repeat( 30 ) );

        USB u = new UGreen();
        u.lightUp();
        u.charge();
        u.transmit();

        System.err.println( "- ".repeat( 30 ) );

        TypeC tc = new UGreen();
        tc.lightUp();
        tc.charge();
        tc.transmit();

        System.err.println( "- ".repeat( 30 ) );

        // UGreen类型的引用变量 指向 UGreen类型的实例(或对象)
        UGreen ug = new UGreen();
        ug.lightUp();
        ug.charge();
        ug.transmit();

    }

}
